<#macro desktop pageTitle showLanguageSelector>

	<#import "spring.ftl" as spring>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.w3.org/1999/xhtml
                          http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
                          
	<head>
		<title>${pageTitle}</title> 
		
		<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> 
		
		<link rel="stylesheet" type="text/css" href="/css/smoothness/jquery-ui-1.9.1.custom.min.css" />
		<link rel="stylesheet" type="text/css" href="/css/style.css" />
		
		<script type="application/javascript" src="/js/jquery-1.8.2.min.js"></script>
		<script type="application/javascript" src="/js/jquery-ui-1.9.1.custom.min.js"></script>
		<script type="application/javascript" src="/js/validate.js"></script>
		<script type="application/javascript" src="/js/sha512.js"></script>
	</head>
	<body>
		<div id="header">
			<div id="header_main">
			
				<div id="top_controls" style="margin-left: 150px; padding-top: 20px;">
					
					<div class="language" style="text-align: right;<#if showLanguageSelector> display:none;</#if>">
						<select name="lang" style="width: 100px;" onchange="return changeLanguage(this);">
							<option value="en"<#if request.getLocale().getLanguage()='en'> selected="selected"</#if>><@spring.message "general.lang.english" /></option>
							<option value="es"<#if request.getLocale().getLanguage()='es'> selected="selected"</#if>><@spring.message "general.lang.spanish" /></option>
							<!-- <option value="ru"<#if request.getLocale().getLanguage()='ru'> selected="selected"</#if>><@spring.message "general.lang.russian" /></option> -->
						</select>
						<script>
							function changeLanguage(elem) {
								var v = $(elem).val();
								var currentPath = window.location.href;
								var newURL = "index.html" + "?lang=" + v;
								window.location.replace(newURL); 
							}
						</script>
					</div>
					
					<#if user.authenticated>
						<div class="info" style="text-align: right; padding-top: 10px;">
							<b>${user.userModel.name}</b> |
							<a href="#">Perfil</a> |
							<a href="/logout.html">Logout</a>
						</div>
							
						<div class="balance" style="text-align: right; padding-top: 5px;">
							<#list userBalance as ub>
								<b>${ub.currencyCode}</b>: ${ub.balanceAsDouble?string("0.0000")} <#if ub_has_next>|</#if> 
							</#list>
						</div>
					<#else>
						<div class="info" style="text-align: right; padding-top: 10px;">
							<a href="login.html">Login</a>
						</div>
					</#if>
					
				</div>
			</div>
		</div>
		
		<div id="main">
			<#nested />
		</div>
		
		<script>
			$(document).ready(function(){
				$("button").button();
			});
		</script>
	</body>
</html>

</#macro>